home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / !runtime / fail.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-18  |  1.7 KB  |  51 lines  |  [TEXT/R*ch]

  1. #ifndef _fail_
  2. #define _fail_
  3.  
  4.  
  5. #include <setjmp.h>
  6. #include "misc.h"
  7. #include "mlvalues.h"
  8.  
  9. #define OUT_OF_MEMORY_EXN 0     /* "exc","Out_of_memory",1 */
  10. #define SYS_ERROR_EXN 1         /* "sys","Sys_error",1 */
  11. #define FAILURE_EXN 2           /* "exc","Failure",3 */
  12. #define INVALID_EXN 3           /* "exc","Invalid_argument",2 */
  13. #define END_OF_FILE_EXN 4       /* "io","End_of_file",1 */
  14. #define ZERO_DIVIDE_EXN 5       /* "int","Division_by_zero",1 */
  15. #define BREAK_EXN 6             /* "sys","Break",2 */
  16. #define NOT_FOUND_EXN 7         /* "exc","Not_found",4 */
  17. #define UNIX_ERROR_EXN 8        /* "unix","Unix_error",1 */
  18. #define GRAPHIC_FAILURE_EXN 9   /* "graphics","Graphic_failure",1 */
  19. #define PARSE_FAILURE_EXN 10    /* "stream","Parse_failure",1 */
  20.  
  21. /* Additional predefined exceptions for Moscow ML */
  22.  
  23. #define SMLEXN_EXCEPTION 11     /* "general","Exception",1 */
  24. #define SMLEXN_BIND      12     /* "general","Bind",2 */
  25. #define SMLEXN_CHR       13     /* "general","Chr",3 */
  26. #define SMLEXN_DIV       14     /* "general","Div",4 */
  27. #define SMLEXN_DOMAIN    15     /* "general","Domain",5 */
  28. #define SMLEXN_MATCH     16     /* "general","Match",6 */
  29. #define SMLEXN_ORD       17     /* "general","Ord",7 */
  30. #define SMLEXN_OVF       18     /* "general","Overflow",8 */
  31.  
  32. /* End of Moscow ML exceptions */
  33.  
  34. struct longjmp_buffer {
  35.   jmp_buf buf;
  36. };
  37.  
  38. extern struct longjmp_buffer * external_raise;
  39. extern value exn_bucket;
  40.  
  41. Noreturn mlraise P((value));
  42. Noreturn raise_with_arg P((tag_t tag, value arg));
  43. Noreturn raise_with_string P((tag_t tag, char * msg));
  44. Noreturn failwith P((char *));
  45. extern volatile unsigned char float_exn;
  46. Noreturn invalid_argument P((char *));
  47. Noreturn raise_out_of_memory P((void));
  48. extern double maxdouble;
  49.  
  50. #endif /* _fail_ */
  51.